package org.example.cmsvue.controller;

import lombok.AllArgsConstructor;
import org.example.cmsvue.entity.Roles;
import org.example.cmsvue.service.IMenusService;
import org.example.cmsvue.utils.R;
import org.example.cmsvue.vo.MenuVO;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author laifeng
 * @since 2025-02-19
 */
@RestController
@RequestMapping("/role")
@AllArgsConstructor
public class RolesController {
    private IMenusService menusService;

    @RequestMapping("/{id}/menu")
    public R<MenuVO> getMenusByRoleId(@PathVariable Integer id) {
        return R.success(menusService.getMenuTreeByRoleId(id));
    }


}
